<template>
	<view class="main_box">
		<view class="fix_title">
			电子钱包信息
		</view>
		<view class="emailInfo">
			<view class="left">
				账户户名
			</view>
			<view class="right">
				{{userInfo.idName}}
			</view>
		</view>
		<view class="emailInfo">
			<view class="left">
				电子账号
			</view>
			<view class="right">
				{{userInfo.cardNo}}
			</view>
		</view>
		<view class="emailInfo">
			<view class="left">
				开户银行
			</view>
			<view class="right">
				{{userInfo.bankName}}
			</view>
		</view>
		<view class="emailInfo">
			<view class="left">
				账户余额
			</view>
			<view class="right">
				{{userInfo.balance}}
			</view>
		</view>
		<view class="deleTips">
			*销户说明：
		</view>
		<view class="listp">
			1、账户注销后电子账户数据将清空，不可恢复。
		</view>
		<view class="listp">
			2、销户后电子钱包余额会自动退回所绑定的I类户，请留意I类户到帐信息
		</view>
		<view class="aginWarn">
			销户操作前请仔细阅读销户说明！
		</view>
		<view class="contrls">
			<view :class="flag?'croc':'croc2'" @click="myAgree">

			</view>
			<view class="tst">
				我已阅读
			</view>
		</view>
		<view :class="flag?'btn':'btn2'" @click="cancelUser">
			销 户
		</view>
		<view class="kdn">
			<image src="/static/images/blank/4341yu.png" mode=""></image>
			<view class="subx">
				交通银行 提供产品服务
			</view>
		</view>
		<uni-popup ref="popup">
			<view class="popup-content">
				<view class="closing">
					销户确认
				</view>
				<view class="cancellation">
					<view class="dds">
						是否确认注销该账户，该操作
					</view>
					<view class="ccb">
						无法撤回！
					</view>
				</view>
				<view class="butts">
					<view class="butLeft" @click="closeUser">
						注销
					</view>
					<view class="butRight" @click="againThink">
						再想想
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		getPhoneCode,
		getTwoUserList,
		getMoneny,
		bindTwoEmpStu,
		deteleUserInfo,
		deleteUserCode,
		TwoUserBindStuList
	} from '../../common/api/blank.js';
	import {
		queryOrg,
		findBaseArea,
		queryMilkCardBalance,
		queryStudentCardBalance,
		selectCardInfoByIdCardNo,
		openStudentMike
	} from '../../common/api/index.js'
	import {
		_showLoading,
		_showToast
	} from '../../common/js/util.js'
	export default {
		data() {
			return {
				batId: "",
				phone: "",
				flag: true,
				userInfo: {
					idName: "",
					cardNo: "",
					bankName: "",
					balance: "",
				},
				idNo: '',
				orgId: ""
			}
		},
		async onLoad(option) {
			this.orgId = option.orgId
			this.batId = option.batId
			this.phone = option.phone
			const res = await getMoneny({
				batId: this.batId,
				orgId: this.orgId
			})
			console.log(res)
			if (res.code == 0) {
				this.idNo = res.data.idCard
				Object.keys(this.userInfo).forEach(item => {
					this.userInfo[item] = res.data[item]
				})
				// console.log(this.userInfo)
			} else {
				_showToast(res.msg)
			}
		},
		onBackPress(options) {
			if (options.from === 'navigateBack') {
				return false
			}
			this.back();
			return true
		},
		components: {

		},
		methods: {
			back() {
				var pages = getCurrentPages();
				uni.navigateBack()
			},
			againThink() {
				this.$refs.popup.close()
			},
			closeUser() {
				this.$refs.popup.close()
				this.flag = true
				uni.navigateTo({
					url: `/pageBlank/components/gatherFace?userName=${this.userInfo.idName}&idNo=${this.idNo}&batId=${this.batId}&phone=${this.phone}&orgId=${this.orgId}&title=销户`
				})
			},
			async cancelUser() {
				if (!this.flag) {
					// const res = await TwoUserBindStuList({
					// 	batId: this.batId
					// })
					// if (res.code == 0) {
					// 	if (res.data.length > 0) {
					// 		_showToast("请先解除已绑定的用户，再进行销毁操作！")
					// 	} else {
					// 		this.$refs.popup.open('center')
					// 	}
					// } else {
					// 	_showToast(res.msg)
					// }
					this.$refs.popup.open('center')
				} else {
					_showToast("仔细阅读销户说明")
				}
			},
			myAgree() {
				this.flag = !this.flag
			},
			//下一步
			toNext() {}
		}
	}
</script>

<style lang="scss" scoped>
	.main_box {
		padding: 24upx;
		box-sizing: border-box;
		overflow-y: auto;

		.kdn {
			margin: 86rpx 0rpx;
			width: 100%;
			display: flex;
			justify-content: center;
			align-items: center;

			>image {
				width: 34rpx;
				height: 33rpx;
			}

			.subx {
				margin-left: 8rpx;
				height: 34rpx;
				font-size: 23rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #003A79;
				line-height: 34rpx;
			}
		}

		.popup-content {
			width: 470rpx;
			height: auto;
			background: #FFFFFF;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			opacity: 1;
			filter: blur(undefinedpx);
			box-sizing: border-box;
			padding-top: 28rpx;

			.closing {
				height: 49rpx;
				text-align: center;
				font-size: 34rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #000000;
				line-height: 49rpx;
				margin: 0 auto;
				margin-bottom: 35rpx;
			}

			.cancellation {
				.dds {
					text-align: center;
					height: 30rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Medium-, PingFangSC-Medium;
					font-weight: normal;
					color: #353535;
					line-height: 30px;
					margin-bottom: 10rpx;
				}

				.ccb {
					text-align: center;
					height: 30rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Medium-, PingFangSC-Medium;
					font-weight: normal;
					color: #353535;
					line-height: 30px;
					margin-bottom: 54rpx;
				}
			}

			.butts {
				display: flex;
				height: 82rpx;
				border-top: 1rpx solid #ccc;

				.butLeft {
					width: 50%;
					text-align: center;
					height: 82rpx;
					font-size: 30rpx;
					font-family: PingFangSC-Medium-, PingFangSC-Medium;
					font-weight: normal;
					color: #000000;
					line-height: 82rpx;
				}

				.butRight {
					width: 50%;
					text-align: center;
					height: 82rpx;
					font-size: 30rpx;
					font-family: PingFangSC-Medium-, PingFangSC-Medium;
					font-weight: normal;
					color: #000000;
					line-height: 82rpx;
					box-sizing: border-box;
					border-left: 1rpx solid #ccc;
				}
			}
		}

		.aginWarn {
			height: 35rpx;
			text-align: center;
			font-size: 24rpx;
			font-family: Source Han Sans CN-Light, Source Han Sans CN;
			font-weight: 300;
			color: #3478F5;
			line-height: 35rpx;
			margin-top: 62rpx;
			margin-bottom: 27rpx;
		}

		.contrls {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-bottom: 50rpx;

			.croc {
				width: 26rpx;
				height: 26rpx;
				border-radius: 50%;
				opacity: 1;
				border: 1rpx solid #3478F5;
				margin-right: 8rpx;
			}

			.croc2 {
				box-sizing: border-box;
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				opacity: 1;
				border: 8rpx solid #3478F5;
				margin-right: 8rpx;
			}

			.tst {
				height: 35rpx;
				font-size: 26rpx;
				font-family: Segoe UI-Regular, Segoe UI;
				font-weight: 400;
				color: #475263;
				line-height: 35rpx;
			}
		}

		.btn {
			width: 358rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			background: #DCDCDC;
			border-radius: 44rpx 44rpx 44rpx 44rpx;
			opacity: 1;
			margin: 0 auto;
			font-size: 32rpx;
			font-family: Source Han Sans CN-Light, Source Han Sans CN;
			font-weight: 300;
			color: #333333;
		}

		.btn2 {
			width: 358rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			background: #3F9BFB;
			border-radius: 44rpx 44rpx 44rpx 44rpx;
			opacity: 1;
			margin: 0 auto;
			font-size: 32rpx;
			font-family: Source Han Sans CN-Light, Source Han Sans CN;
			font-weight: 300;
			color: #fff;
		}

		.deleTips {
			height: 40rpx;
			font-size: 28rpx;
			font-family: Source Han Sans CN-Light, Source Han Sans CN;
			font-weight: 300;
			color: #F71E1E;
			line-height: 40rpx;
			margin-left: 34rpx;
			margin-top: 130rpx;
			margin-bottom: 16rpx;
		}

		.listp {
			margin-left: 52rpx;
			height: 40rpx;
			line-height: 40rpx;
			font-size: 26rpx;
			font-family: Source Han Sans CN-Light, Source Han Sans CN;
			font-weight: 300;
			color: #475263;
		}

		.emailInfo {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 0 45rpx;
			margin-bottom: 46rpx;

			.left {
				height: 46rpx;
				font-size: 32rpx;
				font-family: Source Han Sans CN-Medium, Source Han Sans CN;
				font-weight: 500;
				color: #020202;
				line-height: 46rpx;
			}

			.right {
				height: 44rpx;
				font-size: 30rpx;
				font-family: Source Han Sans CN-Regular, Source Han Sans CN;
				font-weight: 400;
				color: #020202;
				line-height: 44rpx;
			}
		}

		.fix_title {
			margin: 30upx 0 60upx 0;
			font-size: 40upx;
			font-weight: bolder;
			display: flex;
			align-items: center;
			margin-left: 10rpx;
			margin-bottom: 56rpx;

			&::before {
				content: '';
				height: 36upx;
				width: 12upx;
				background-image: linear-gradient(to bottom, #c3defc, #007AFF);
				margin-right: 12upx;
				border-radius: 6upx;
			}
		}
	}
</style>
